import {View, Image, Button} from '@tarojs/components';
import React, {useState, useEffect} from 'react';
import Taro, {Config} from '@tarojs/taro';
import NavBar from '../fit';
import {AtDivider, AtForm} from 'taro-ui';
import check from '../image/check-circle.png';
import './newaddress.scss';

function Newaddress() {
  const toBack = () => {
    Taro.navigateBack().then();
  }
  const toHome = () => {
    Taro.redirectTo({url: "pages/index/index"}).then();
  }


  const [list, setList] = useState(
    [
      {
        name: '名字',
        tel: '电话',
        city:'城市',
        address:'地址',

      },
    ]
  )


  const List = list.map((content) => (
    <View className="box1">
      <View className="box11">
        <View className="inf">联系人信息</View>
        <View className="nt">
          <View className="name">
            <View>{content.name}</View>
            <AtDivider height="60" />
          </View>
          <View className="tel">
            <View>{content.tel}</View>
            <AtDivider height="60" />
          </View>
        </View>
        <View className="city">{content.city}</View>
        <AtDivider height="60" />
        <View className="address">{content.address}</View>
        <AtDivider height="60" />
        <View className="momo">
          <View className="momol">
            <Image style="width:15px;height:15px;opacity:0.5;" src={check}></Image>
            <View className="momolr">设为默认地址</View>
          </View>
          <View className="momor">清空当前信息</View>
        </View>
      </View>
    </View>

  ))



  return (
    <View className="box">
      <NavBar
        title="新增地址"
        // color="#ffffff"
        back={true}
        nback={toBack}
        home={true}
        onHome={toHome}

      />


      <AtForm className="bd">
        {List}

        <View className="box2">
          <Button className="box21">同意</Button>
        </View>
      </AtForm>


    </View>

  )
}

export default Newaddress
